<script>
  import $ from 'dfish-widget'
  import Method from '../Method.vue'

  export default {
    mixins: [Method],
    data() {
      return {
        name: '$.strTo(str, from, [last])',
        remark: '截取从开始到某个或某些字符为止的字符串。如果没有匹配到则返回空字符串。',
        attrs: [{
          name: 'str',
          remark: '字符串',
          type: 'String',
        },{
          name: 'from',
          remark: '匹配的字符',
          type: 'String',
        },{
          name: 'last',
          remark: '是否截止到最后一次匹配的字符',
          type: 'Boolean',
        }],
        examples: [{
          remark: '范例',
          code: `
            let s = $.strTo('m/pub/test.js', '/'); // 返回 "m"
            let s = $.strTo('m/pub/test.js', '/', true); // 返回 "m/pub"
            `
        }]
      }
    }
  }
</script>
